package org.example.demo21.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.example.demo21.entity.po.UserPO;
import org.example.demo21.service.UserService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 *
 * @author guocong
 * @since 2024/3/11 15:33
 */

@RestController
@Tag(name = "咖啡因缓存测试接口")
@RequestMapping("/user")
public class UserController {

    @Resource
    private UserService userService;


    @Operation(summary = "缓存", description = "缓存", method = "POST")
    @GetMapping(value = "/cache")
    public UserPO cache(String username) {
        return userService.getCache(username);
    }

    @Operation(summary = "缓存", description = "缓存", method = "POST")
    @GetMapping(value = "/get")
    public UserPO get(Long id) {
        return userService.get(id);
    }


}
